iiisupport = {
$getSearchBox : function()
    {
        var $search = $("#search");
        return $search;
    },
    $getResults : function() 
    {
        var $results = $(".searchResultsWrapper");
        return $results;
    },
    performSearch : function($search, servicesURL) 
    {
        var edition = $search.attr("edition");
        var catalog = $search.attr("catalog");
        var val = $search.val();
        $search.addClass("searchLoading");
        $.getJSON(servicesURL + "cjax/" + edition + "/" + catalog + "/keyword/" + val, function(data) {
            var $searchWidget = $("<div></div>");
            var $display = $searchWidget.filter('div');
            var catalogURL = data.catalogInfo.url + "/record=";
            var catalogName = data.catalogInfo.name;
            var length;
            if (data.searchResults.length > 5) {
                length = 5;
            }
            else {
                length = data.searchResults.length;
            }
            for (var i = 0; i < length; i++) {
                var $holdingsWidget = $("<div class='cjax-result'><span class='cjax-title'>" + data.searchResults[i].title + "</span>" +
                    "<a class='cjax-moreInfo' 'href='" + catalogURL + data.searchResults[i].bibrecord + "' title='View More Info in "+ catalogName +"' target='_blank'>More Info...</a>" +
                    "<a class='cjax-checkAvailability' 'href='javascript:'>Check Availability</a><br />" +
                    "<div class='cjax-availabilityResults' 'style='display: none;'>Loading...</div>" +
                    "</div>"
                );
                $display.append($holdingsWidget);
                //var $availabilityLink = $holdingsWidget.children('a:nth-child(2)');
                (function(bibrecord, $availabilityLink) {
                    $availabilityLink.click( function() {
                        var $resultsDiv = $(this).siblings('div');
                        if ($resultsDiv.css("display") == "none") {
                            $(this).text("Hide Availability");
                        }
                        else {
                            $(this).text("Check Availability");
                        }
                        $resultsDiv.slideToggle();
                        if ($availabilityLink.loaded === undefined) {
                            $resultsDiv.addClass("searchLoading");
                            $.getJSON(servicesURL + "opac/" + edition + "/" + catalog + "/bibrecord/" + bibrecord, function(dat) {
                                $resultsDiv.empty().removeClass("searchLoading");
                                for (var k = 0; k < dat.holdings.length; k++) {
                                    if (dat.mapURL[k]) {
                                    $resultsDiv.append("<div style='width: 100%;'>" + 
                                    "<span class='availabilityLocation'>" + 
                                    "<a class='cjax-locationLink' href='" + dat.mapURL[k] + "' title='Map to Location' target='_blank'>" + dat.locations[k] + "</a>" +
                                    "</span>" +
                                    "<span class='availabilityStatus'>" + dat.holdings[k] + "</span>" +
                                    "</div>");
                                    }
                                    else {
                                    $resultsDiv.append("<div style='width: 100%;'>" +
                                    "<span class='availabilityLocation'>" +
                                    dat.locations[k] +
                                    "</span>" +
                                    "<span class='availabilityStatus'>" + dat.holdings[k] + "</span>" +
                                    "</div>");
                                    }
                                }
                                $availabilityLink.loaded = true;
                            });
                        }

                    });
                })(data.searchResults[i].bibrecord, $holdingsWidget.children('a:nth-child(3)'));

/**
                $.getJSON("../opac/" + edition + "/" + catalog + "/bibrecord/" + data.searchResults[i].bibrecord, function(dat) {
                    $displayHoldings.append("&nbsp;&nbsp;&nbsp;");
                    for (var k = 0; k < dat.holdings.length; k++) {
                        $av.append(dat.holdings[k] + "<br />");
                    }
                });
**/
            }
            //$search.siblings("div").remove();
            //$search.parent().append($searchWidget);
            var resultsDivClass = $search.attr("resultsDivClass");
            var $resultsDiv = $("." + resultsDivClass);
            $resultsDiv.empty().append($searchWidget).slideDown("slow");
            $search.removeClass("searchLoading");
        });

    }
   
}
